import request from '@/utils/request'

// 获取师训签到记录列表(带分页)
export function getTrainSignRecordList(data) {
  return request({
    url: '/api/campus/trainsignrecord',
    method: 'GET',
    data
  })
}

// 获取师训签到记录详情
export function getTrainSignRecordInfo(id) {
  return request({
    url: `/api/campus/trainsignrecord/${id}`,
    method: 'GET'
  })
}

// 手动签到
export function manualSignIn(data) {
  return request({
    url: '/api/campus/trainsignrecord/manual',
    method: 'POST',
    data
  })
}

// 批量手动签到
export function batchManualSignIn(data) {
  return request({
    url: '/api/campus/trainsignrecord/batch/manual',
    method: 'POST',
    data
  })
}

// 获取师训签到统计
export function getTrainSignStatistics(trainId, data) {
  return request({
    url: `/api/campus/trainsignrecord/statistics/${trainId}`,
    method: 'GET',
    data
  })
}

// 获取师训签到汇总
export function getTrainSignSummary(trainId) {
  return request({
    url: `/api/campus/trainsignrecord/summary/${trainId}`,
    method: 'GET'
  })
}

// 导出签到记录
export function exportSignRecords(data) {
  return request({
    url: '/api/campus/trainsignrecord/export',
    method: 'GET',
    data,
    responseType: 'blob'
  })
}

// 获取签到记录按日期分组
export function getSignRecordsByDate(trainId, data) {
  return request({
    url: `/api/campus/trainsignrecord/bydate/${trainId}`,
    method: 'GET',
    data
  })
}

// 获取签到记录按时段分组
export function getSignRecordsByPeriod(trainId, data) {
  return request({
    url: `/api/campus/trainsignrecord/byperiod/${trainId}`,
    method: 'GET',
    data
  })
}

// 获取未签到人员列表
export function getAbsenteeList(trainId, data) {
  return request({
    url: `/api/campus/trainsignrecord/absentee/${trainId}`,
    method: 'GET',
    data
  })
}

// 获取师训签到状态概览
export function getTrainSignOverview(trainId) {
  return request({
    url: `/api/campus/trainsignrecord/overview/${trainId}`,
    method: 'GET'
  })
}

// 修改签到记录
export function updateSignRecord(data) {
  return request({
    url: '/api/campus/trainsignrecord/update',
    method: 'PUT',
    data
  })
}

// 批量修改签到记录
export function batchUpdateSignRecord(data) {
  return request({
    url: '/api/campus/trainsignrecord/batch-update',
    method: 'PUT',
    data
  })
}

// 获取师训签到详细统计
export function getTrainSignDetailStatistics(trainId, params) {
  return request({
    url: `/api/campus/trainsignrecord/detail-statistics/${trainId}`,
    method: 'GET',
    params
  })
}
